#! /usr/bin/env python
from hplog  import HPLog
from ctypes import *

class log_conf(Structure):
    _fields_=[('local_log_path',c_char*256),#the path of the local log
              ('process_name',c_char*16),   #the name of the process,it's optional 
              ('log_severity',c_ubyte),     #the log threshold,if the user's log level is less than the threshold,it will be droped
              ('protocol',c_ubyte),         #unused
              ('reserved',c_ubyte),         #unused
              ('max_log_size',c_uint),      #the quota for the local log size
              ('flags',c_uint)]             #flags for the action,1--write log to local
                                            #                     2--write log to remote
                                            #                     4--write log to mornitor
                                            #the values for the flags can be added 1|2|4

def main():
    conf = log_conf();
    conf.local_log_path = "/home/kevenzhu/project/hplog_proj/trunk/hplog_client/src/python/test.log"
    conf.process_name   = "pythonlog"
    conf.log_severity   = 0
    conf.max_log_size   = 1024
    conf.flags          = 3
    p_conf              = pointer(conf);

    hplog = HPLog("../libhplog.so", p_conf)
    hplog.tx_log(2,"this is a test string from python")

if __name__ == '__main__':
    main()

